//
//  FKOrderDetailContactCell.m
//  WanTao
//
//  Created by Macbook Pro on 2019/4/12.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKOrderDetailContactCell.h"
#import "FKOrder.h"

@interface FKOrderDetailContactCell ()

@property (nonatomic, weak) UILabel *nameLabel;
@property (nonatomic, weak) UILabel *mobileLabel;
@property (nonatomic, weak) UILabel *remarkLabel;

@end

@implementation FKOrderDetailContactCell

- (void)setupSubviews
{
    [super setupSubviews];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    UILabel *nameTitle = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333 text:@"联系人:"];
    [self.contentView addSubview:nameTitle];
    
    UILabel *nameLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333];
    [self.contentView addSubview:nameLabel];
    self.nameLabel = nameLabel;
    
    UILabel *mobileLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333];
    [self.contentView addSubview:mobileLabel];
    self.mobileLabel = mobileLabel;
    
    UILabel *remarkTitle = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor666666 text:@"备注:"];
    [self.contentView addSubview:remarkTitle];
    
    UILabel *remarkLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333];
    [self.contentView addSubview:remarkLabel];
    self.remarkLabel = remarkLabel;
    
    [nameTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(12);
        make.top.offset(fk_adjustW(12));
    }];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(nameTitle.mas_right).offset(8);
        make.centerY.equalTo(nameTitle);
    }];
    [mobileLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(nameLabel.mas_right).offset(20);
        make.centerY.equalTo(nameTitle);
    }];
    [remarkTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(nameTitle);
        make.bottom.offset(fk_adjustW(-12));
    }];
    [remarkLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(nameLabel);
        make.right.lessThanOrEqualTo(self.contentView.mas_right).offset(-12);
        make.centerY.equalTo(remarkTitle);
    }];
}

- (void)setData:(id)data
{
    [super setData:data];
    
    if ([data isKindOfClass:[FKOrder class]]) {
        FKOrder *model = data;
        self.nameLabel.text = model.user_name;
        self.mobileLabel.text = model.mobile;
        self.remarkLabel.text = model.remark;
    }
}


@end
